﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using GameSushi.TweenEngine;

#endregion

namespace GameSushi.SourceGame
{
    public class SushiName
    {
        private static SushiName instance;
        
        private SushiName()
        {

        }

        public static SushiName Instance
        {
            get
            {
                if (instance == null) {
                    instance = new SushiName();
                }

                return instance;
            }
        }

        
        public string[] sushiNormal = {
            "Sushi/sushi_1n",
            "Sushi/sushi_2n",
            "Sushi/sushi_3n",
            "Sushi/sushi_4n",
            "Sushi/sushi_5n",
            "Sushi/sushi_6n"
        };

        //mang de luu tat ca hinh anh cua sushi. 
        public Texture2D[] arrTextureSushi;

        //load texture 
        public void LoadTexureSushi(ContentManager content)
        {
            arrTextureSushi = new Texture2D[GameConfig.TOTAL_SUSHI];
            for (int i = 0; i < GameConfig.TOTAL_SUSHI; i++) 
            {
                arrTextureSushi[i] = content.Load<Texture2D>(sushiNormal[i]);
            }
        }
    }

    public class Sushi
    {
        private static readonly Random random = new Random();
        public Color _color { get; set; }
        public float _rotation { get; set; }
        public float _scale { get; set; }
        public int _col { get; set; }
        public int _row { get; set; }
        public int _id { get; set; }
        public Vector2 _pos { get; set; }
        public Texture2D _textureSushi;

        public Sushi()
        {
            _col = 0;
            _row = 0;
            _id = 0;
            _scale = 1f;
            _rotation = 0f;
            _color = Color.White;
        }

        public Sushi(int row, int col)
        {
            //Random rand = new Random();
            int id = random.Next(0, GameConfig.TOTAL_SUSHI);
            this._col = col;
            this._row = row;
            this._id = id;
            this._textureSushi = SushiName.Instance.arrTextureSushi[id];
            this._scale = 1f;
            this._rotation = 0f;
            this._color = Color.White;
            //Tween.To(this, 1, 0.1f);
        }

        public Sushi create(int row, int col) 
        {
            Sushi _sushi = new Sushi(row, col);
           
            return _sushi;
        }
    }
}
